<!DOCTYPE html>
<!-- 我改过-->
<html>

<head>
    <meta charset="UTF-8">
    <title>个人报名</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css"/>
    <link rel="stylesheet" href="../css/font-awesome.min.css"/>
</head>

<body>
<div class="container" style="width: 700px;" id="baomingText">
    <div class="panel panel-default text-center">
        <div class="panel-header">
            <h3>个人报名</h3>
        </div>
        <div class="panel-body">
            <table class="table table-bordered">
                <tr>
                    <td>
                        <label>姓名：</label>
                    </td>
                    <td>
                        <input type="text" v-model="name" class="form-control"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>学号：</label>
                    </td>
                    <td>
                        <input type="text" v-model="noid" class="form-control"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>联系电话：</label>
                    </td>
                    <td>
                        <input type="tel" v-model="phone" class="form-control"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>备注：</label>
                    </td>
                    <td>
                        <input type="text" v-model="note" class="form-control"/>
                    </td>
                </tr>
            </table>
        </div>
        <div class="panel-footer">
            <button class="btn btn-danger" @click="add">提交</button>
        </div>
    </div>
</div>

<script type="text/javascript " src="../js/jquery-3.3.1.min.js "></script>
<script type="text/javascript " src="../js/bootstrap.min.js "></script>
<script src="../js/vue.min.js"></script>
<script src="../js/axios.min.js"></script>
<script type="text/javascript" src="../js/cookieUtil.js"></script>

<script type="text/javascript">
    var url1 = 'http://donting.free.idcfengye.com';
    var baomingText = new Vue({
        el: '#baomingText',
        data: {
            deId: '',
            name: '',
            noid: '',
            phone: '',
            note: '',
        },
        methods: {

            add: function () {
                //发送get请求
                axios.defaults.withCredentials = true;
                axios.get(url1 + '/apply/add', {
                    params: {
                        "deId" :  baomingText.deId,
                        "member": baomingText.noid + '-' + baomingText.name + ';',
                        "phone": baomingText.phone,
                        "note": baomingText.note
                    }

                }).then(function (response) {
                    var gf = response.data;
                    if (gf.code == 200) {
                        alert('报名成功');
                        window.history.back(-1);
                        history.go(-1);
                    } else {
                        alert("报名失败");
                    }

                }).catch(function (error) {
                    alert("连接超时！");
                })

            }
        },
        mounted() {
            this.deId = getCookie('deId');
            console.log(this.deId+"---deId")
        }
    })
</script>


</body>

</html>
